﻿namespace ClassyBlog.Infrastructure
{
    using System.Web;
    using System.Web.Routing;

    public class PresenceConstraint : IRouteConstraint
    {
        public bool Match(
            HttpContextBase httpContext,
            Route route,
            string parameterName,
            RouteValueDictionary values,
            RouteDirection routeDirection)
        {
            return (values != null) &&
                   values.ContainsKey(parameterName) &&
                   (values[parameterName] != null);
        }
    }
}